package org.jimmy.tang.beanpostprocessor;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;

/**
 * @author jimmy
 * 
 */
public class BeanPostPrcessorImpl implements BeanPostProcessor {

    /* 
     * Bean 实例化之前进行的处理
     * (non-Javadoc)
     * @see org.springframework.beans.factory.config.BeanPostProcessor#postProcessBeforeInitialization(java.lang.Object, java.lang.String)
     */
    @Override
    public Object postProcessBeforeInitialization(Object bean, String beanName)
            throws BeansException {
        System.out.println("对象" + beanName + "开始实例化");

        return bean;
    }

    /* 
     * Bean 实例化之后进行的处理
     * (non-Javadoc)
     * @see org.springframework.beans.factory.config.BeanPostProcessor#postProcessAfterInitialization(java.lang.Object, java.lang.String)
     */
    @Override
    public Object postProcessAfterInitialization(Object bean, String beanName)
            throws BeansException {
        System.out.println("对象" + beanName + "实例化完成");

        return bean;
    }

}
